package com.qf.controller;

import com.qf.pojo.repVo.BaseResp;
import com.qf.pojo.reqVo.OrderReq;
import com.qf.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

@RequestMapping("/order")
@RestController
public class OrderController {

    @Autowired
    OrderService orderService;

    @RequestMapping("/addOrder")
    public BaseResp addOrder(@RequestBody OrderReq orderReq, HttpServletRequest request){
        return orderService.addOrder(orderReq,request);
    }

    @RequestMapping("/findOrderByUserId")
    public BaseResp findOrderByUserId(HttpServletRequest request){
        return orderService.findOrderByUserId(request);
    }

    @RequestMapping("/findByOrderid")
    public BaseResp findByOrderid(@RequestParam("orderid")String orderid){
        return orderService.findByOrderid(orderid);
    }
    @RequestMapping("/updateStatus")
   public BaseResp updateOrderStatus(@RequestParam("orderid")String orderid,@RequestParam("status") int i){
        return orderService.updateStatus(orderid,i);
    }
}
